Add exclude flag to bench, check and test
authortorkleyy <thomas-schaller2000@gmx.de>
Fri, 12 May 2017 13:05:28 +0000 (15:05 +0200)
committertorkleyy <thomas-schaller2000@gmx.de>
Sat, 27 May 2017 18:33:00 +0000 (20:33 +0200)
src/bin/bench.rs
src/bin/check.rs
src/bin/test.rs

index 6fa70f2b998d408f431347d1ea16ee89f432709d..ba5a716dd356fbdcd408b4df12f832a0d7d582b3 100644 (file)
@@ -30,6 +30,7 @@ pub struct Options {
     flag_locked: bool,
     arg_args: Vec<String>,
     flag_all: bool,
+    flag_exclude: Vec<String>,
 }
 
 pub const USAGE: &'static str = "
@@ -52,6 +53,7 @@ Options:
     --no-run                     Compile, but don't run benchmarks
     -p SPEC, --package SPEC ...  Package to run benchmarks for
     --all                        Benchmark all packages in the workspace
+    --exclude SPEC ...           Exclude packages from the benchmark
     -j N, --jobs N               Number of parallel jobs, defaults to # of CPUs
     --features FEATURES          Space-separated list of features to also build
     --all-features               Build all available features
@@ -86,11 +88,9 @@ Compilation can be customized with the `bench` profile in the manifest.
 pub fn execute(options: Options, config: &Config) -> CliResult {
     let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
 
-    let spec = if options.flag_all {
-        Packages::All
-    } else {
-        Packages::Packages(&options.flag_package)
-    };
+    let spec = Packages::from_flags(options.flag_all,
+                                    &options.flag_exclude,
+                                    &options.flag_package)?;
 
     config.configure(options.flag_verbose,
                      options.flag_quiet,
index 20e7b3bfc733cb71b65195489e36a0e9814f4975..147ff43b9a97e3b429207fc061fdde866e0b43d0 100644 (file)
@@ -15,6 +15,7 @@ Options:
     -h, --help                   Print this message
     -p SPEC, --package SPEC ...  Package(s) to check
     --all                        Check all packages in the workspace
+    --exclude SPEC ...           Exclude packages from the check
     -j N, --jobs N               Number of parallel jobs, defaults to # of CPUs
     --lib                        Check only this package's library
     --bin NAME                   Check only the specified binary
@@ -74,6 +75,7 @@ pub struct Options {
     flag_locked: bool,
     flag_frozen: bool,
     flag_all: bool,
+    flag_exclude: Vec<String>,
 }
 
 pub fn execute(options: Options, config: &Config) -> CliResult {
@@ -89,11 +91,9 @@ pub fn execute(options: Options, config: &Config) -> CliResult {
     let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
     let ws = Workspace::new(&root, config)?;
 
-    let spec = if options.flag_all {
-        Packages::All
-    } else {
-        Packages::Packages(&options.flag_package)
-    };
+    let spec = Packages::from_flags(options.flag_all,
+                                    &options.flag_exclude,
+                                    &options.flag_package)?;
 
     let opts = CompileOptions {
         config: config,
index 817c2bcc35d1e2d9d70dd937307282df26332e02..7829cb36601db654be5afb1bff5e9b5efb0f8d63 100644 (file)
@@ -33,6 +33,7 @@ pub struct Options {
     flag_frozen: bool,
     flag_locked: bool,
     flag_all: bool,
+    flag_exclude: Vec<String>,
 }
 
 pub const USAGE: &'static str = "
@@ -56,6 +57,7 @@ Options:
     --no-run                     Compile, but don't run tests
     -p SPEC, --package SPEC ...  Package to run tests for
     --all                        Test all packages in the workspace
+    --exclude SPEC ...           Exclude packages from the test
     -j N, --jobs N               Number of parallel builds, see below for details
     --release                    Build artifacts in release mode, with optimizations
     --features FEATURES          Space-separated list of features to also build
@@ -130,11 +132,9 @@ pub fn execute(options: Options, config: &Config) -> CliResult {
                                          &options.flag_bench, options.flag_benches);
     }
 
-    let spec = if options.flag_all {
-        Packages::All
-    } else {
-        Packages::Packages(&options.flag_package)
-    };
+    let spec = Packages::from_flags(options.flag_all,
+                                    &options.flag_exclude,
+                                    &options.flag_package)?;
 
     let ops = ops::TestOptions {
         no_run: options.flag_no_run,